import urllib.request
import random

proxy_addr = ["175.44.109.39:9999", "1.197.203.36:9999", "123.163.118.147:9999",
                "183.166.70.206:9999","119.120.22.233:9999","114.239.144.75:9999",
                "112.83.170.162:9999","115.218.2.52:9999","182.87.45.116:9999",]

index = random.randint(0,8)

headers = {
        "User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36 Edg/87.0.664.60"
}
url = "https://movie.douban.com/top250"

proxy = urllib.request.ProxyHandler({"http": proxy_addr[index]})
opener = urllib.request.build_opener(proxy, urllib.request.HTTPHandler)
urllib.request.install_opener(opener)

req = urllib.request.Request(url=url, headers=headers)
data = urllib.request.urlopen(req).read().decode("utf-8")
print(data)
    